package main;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.JFrame;

public class AISFrame extends JFrame implements ItemListener, ActionListener{
	
	public Container contentPane;
	public AISMenuBar menuBar;
	public AISCanvasScrollPane canvasScrollPane;
	public AISModuleScrollPane moduleScrollPane;
	public AISModuleButtonPanel moduleButtonPanel;
	
	public AISFrame(String windowName){
		super(windowName);
		setLayout(null);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(new Dimension(800, 600));
        contentPane = getContentPane();
        setLocationRelativeTo(null);
        
        menuBar = new AISMenuBar(this);
        canvasScrollPane = new AISCanvasScrollPane();
        moduleScrollPane = new AISModuleScrollPane();
        moduleButtonPanel = new AISModuleButtonPanel(moduleScrollPane);
        setJMenuBar(menuBar);
        add(canvasScrollPane);
        add(moduleScrollPane);
        add(moduleButtonPanel);
        canvasScrollPane.setBounds(200, 50, 600, 550);
        moduleScrollPane.setBounds(0, 50, 200, 350);
        moduleButtonPanel.setBounds(0, 0, 200, 50);
        canvasScrollPane.setVisible(false);
        moduleScrollPane.setVisible(false);
        moduleButtonPanel.setVisible(false);
	}

	public void actionPerformed(ActionEvent arg0) {
	}
	
	public void itemStateChanged(ItemEvent arg0) {
	}
	
	public void close(){
		setVisible(false);
		dispose();
	}
	
	public void createAndShowGUI() {
        setLocationRelativeTo(null);
        setVisible(true);
	}

	public void open_file() {
//		JFileChooser fileChooser = new JFileChooser();
//        fileChooser.setFileFilter(new AISFilter(".xml"));
//		int returnVal = fileChooser.showOpenDialog(this);
//        if (returnVal == JFileChooser.APPROVE_OPTION) {
//            File file = fileChooser.getSelectedFile();
//            AthenaMain.manager.loadFromFile(file);
//        }
		canvasScrollPane.setImage("hola.png");
		canvasScrollPane.setVisible(true);
        moduleScrollPane.setVisible(true);
        moduleButtonPanel.setVisible(true);
	}
}
